import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { VantResolver } from 'unplugin-vue-components/resolvers';

export default defineConfig({
  plugins: [
    vue(),
    Components({
      resolvers: [
        // 自动导入Vant所有组件
        VantResolver({
          importStyle: true, // 自动导入组件样式
          resolveIcons: true // 同时导入图标组件
        }),
        // 自动导入Vant组件和API
        AutoImport({
          resolvers: [VantResolver()]
        })
      ]
    })
  ],
   server: {
     proxy: {
       '/api': {
         target: 'http://localhost:8080',
         changeOrigin: true
       }
     }
   }
})

